package com.aloda.config;

import com.aloda.properties.AiProperties;
import com.zhipu.oapi.ClientV4;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

@Slf4j
@Configuration
public class AiConfig {

    @Resource
    private AiProperties aiProperties;

    @Bean
    public ClientV4 getClientV4() {
        log.info("开始初始化智谱AI客户端...");
        String apiKey = aiProperties.getZhiPuApiKey();
        return new ClientV4.Builder(apiKey)
                .networkConfig(60,60, 60, 60, TimeUnit.SECONDS)
                .build();
    }
}
